<?php 
include("config.php");
session_start();
require('db/opendb.php');
$listing_id = $_GET['listing_id'];

$mquery = "select p.*, po.Owner from PROPERTIES p LEFT JOIN Prop_Owner_Con po on (p.OID=po.Prop_OID) WHERE p.OID = '".$listing_id."'";
$mresult = mysql_query($mquery) or die ("SQL Error".mysql_error());
if(mysql_num_rows($mresult)>0) {
	$row = mysql_fetch_assoc($mresult);
	//	echo "<pre>";print_r($row);exit;
	$sql = "SELECT * FROM Users WHERE ID='{$row['Owner']}'";
	$agent_rs = mysql_query($sql) or die ("SQL Error".mysql_error());
	$agent = mysql_fetch_assoc($agent_rs);
	//		echo "<pre>";print_r($agent);exit;
}
else {
	echo "Listing not found";exit;
}

$mquery2 = "select * from Listing_Images where Listing_ID = '".$listing_id."' and Type = 'IMAGE' ORDER BY sort_order";

$mresult2 = mysql_query($mquery2) or die ("SQL Error".mysql_error());
$images = array();
$imgages_arr = array();
$i=0;
while($mrow2 = mysql_fetch_assoc($mresult2))
{
	//	echo "<pre>";print_r($mrow2);exit;
	if($_SERVER['HTTP_HOST'] == 'realivent_test.info') {
		$mrow2['Server_Path'] = 'http://realivent_test.info/listing_images/';
	}
	$images[] = "{image : '{$mrow2['Server_Path']}{$mrow2['Path']}', title : '{$mrow2['Description']}', url : '{$mrow2['Server_Path']}{$mrow2['Path']}'}";
	$imgages_arr[$i]['img'] = 'listing_images/'.$mrow2['Path'];
	$imgages_arr[$i]['desc'] = $mrow2['Description'];
	$i++;
}

$images_str = implode(",", $images);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">

	<head profile="http://gmpg.org/xfn/11">

	<title>Realivent:<?php echo $row['TITLE']?></title>
	
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	
	<link rel="stylesheet" href="../supersized/supersized.css" type="text/css" media="screen" />
	
	<link rel="stylesheet" href="../imgflow/style.css" type="text/css" media="screen"/>
	<link rel="stylesheet" href="../imgflow/imageflow.css" type="text/css" media="screen"/>
	
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
	<script src="../supersized/js/effects.core.js"></script>
	<script src="../supersized/js/effects.slide.js"></script>
	
	<script type="text/javascript" src="../imgflow/imageflow.js"></script>
	
	<script type="text/javascript" src="../supersized/supersized.3.0.js"></script>
	<script type="text/javascript">
	var img_root = '<?php echo SITE_ROOT_URL?>';
	$(function(){
		$.fn.supersized.options = {
			startwidth: 640,
			startheight: 480,
			vertical_center: 1,
			slideshow: 1,
			navigation: 1,
			thumbnail_navigation: 1,
			transition: 1, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
			pause_hover: 0,
			slide_counter: 1,
			slide_captions: 1,
			slide_interval: 5000,
			slides : [
			<?php echo $images_str ?>
			]
		};
		$('#supersized').supersized();
	});
	</script>
	
</head>

<body>

<!--Loading display while images load-->
<div id="loading">&nbsp;</div>

<!--Slides-->
<div id="supersized"></div>
<div id="myImageFlow" class="imageflow">
<?php
foreach ($imgages_arr as $img)
{
	echo "<img src=\"{$img['img']}\" longdesc=\"{$img['img']}\" width=\"400\" height=\"300\" alt=\"{$img['desc']}\"/>";
//	echo "<img src=\"$imgsrc\" longdesc=\"$imgsrc\" width=\"400\" height=\"300\" />";
//	echo "<img src=\"$imgsrc\" longdesc=\"$imgsrc\" width=\"400\" height=\"300\" />";
}
?>
</div>
<!--
<div id="prevthumb"></div>
<div id="nextthumb"></div>
-->		

<!--Control Bar-->
<!--<div id="controls-wrapper">
	<div id="controls">
-->	
		<!--Slide counter-->
<!--		<div id="slidecounter">
			<span class="slidenumber"></span>/<span class="totalslides"></span>
		</div>
-->		
		<!--Slide captions displayed here-->
<!--		<div id="slidecaption"></div>
-->		
		<!--Navigation-->
<!--		<div id="navigation">
			<img id="prevslide" src="../supersized/images/back_dull.png"/><img id="pauseplay" src="../supersized/images/pause_dull.png"/><img id="nextslide" src="../supersized/images/forward_dull.png"/>
		</div>
		
	</div>
</div>
-->
<!--Content Area-->
<div id="content-wrapper">
	<?php include(ABS_PATH."hover_content.php")?>
</div>

</body>
</html>
